# coding: utf-8
class User < ActiveRecord::Base

	has_many :doccategorys, :class_name => 'DocCategory', :foreign_key => "userid"
	has_many :docmains, :class_name => 'DocMain', :foreign_key => "userid"
	has_many :memos, :class_name => 'Memo', :foreign_key => 'userid'

  	attr_accessible :answer, :name, :pass, :question, :email, :mobile

  	validates :name, :presence => true, :length => {:minimum => 4}
  	validates_uniqueness_of :name, :message => '该名称已被人抢注，你来晚鸟～'

	validates :pass, :presence => true, :length => {:minimum => 6}
end
